package cn.glutnn.oss.service;

import cn.glutnn.oss.adapter.StorageAdapter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * Author:   msh
 * Date:     2024/12/5 下午2:34
 * Description:
 */
@Service
public class FileService {
    private final StorageAdapter storageAdapter;

    public FileService(@Qualifier("getStorageService") StorageAdapter storageAdapter) {
        this.storageAdapter = storageAdapter;
    }

    public List<String> listBuckets(){
        return storageAdapter.listBuckets();
    }

    public String upload(MultipartFile file, String bucketName, String objectName) {
        return storageAdapter.uploadFile(file,bucketName, objectName);
    }
}
